package Flap::Template::Directive::Elsif;
use Flap qw/-b Flap::Template::Directive -s -w/;
use constant BELONGS_TO => 'IF';

sub begin {
    my($dtv, $doc, $ft) = @_;
    $doc->{tmp}{$dtv->{prev_id}} ? ($dtv->{last_id} + 1) :
    ($doc->{tmp}{$dtv->{id}} = $dtv->{pl}{code}->($doc) && 1) ? $doc->block($dtv) :
    $dtv->{next_id};
}

sub parse { shift->_parse_if(@_) }

1;
